Tag Link | [Net->SetBlocking] | Category | Networking |
---|---|---|---|
Type | Member | Source Available | No |
Support | Preferred | Version | 7.0 |
Change | Unchanged | Data Source | Any |
Output Type | Image | Security | None |
Implementation | LCAPI | Sets | Lasso 8.5, Lasso 8.0, Lasso 7.0 |
[Net->SetBlocking] requires a single boolean parameter which specifies whether the connection should block until reads and writes are complete. By default all connections use blocking.
<?LassoScript
Variable: 'Connection' = (Net);
$Connection->(SetBlocking: True);
$Connection->(Connect: 'www.example.com', '80');
...
?>
Required Parameters | |
---|---|
Boolean | Specifies whether the connection should block or not. |
To connect to a remote server using non-blocking TCP:
Use the [Net] type and its member tags to establish a TCP connection. The following example opens a non
[Variable: 'myConnection' = (Net)]
[$myConnection->(SetBlocking: False)]
[Var: 'Result' = $myConnection->(Connect: 'www.example.com', 80)]
[Fail_If: $Result != Net_ConnectOK, (-1), 'TCP Error']
[Var: 'Result' = $myConnection->(Wait: 60, Net_WaitWrite)]
[Fail_If: $Result == Net_WaitTimeOut, (-1), 'TCP Timeout']
[Variable: 'Result' = $myConnection->(Write: 'GET / HTTP/1.0\r\n\r\n')]
[Var: 'Result' = $myConnection->(Wait: 60, Net_WaitRead)]
[Fail_If: $Result == Net_WaitTimeOut, (-1), 'TCP Timeout']
[Variable: 'Output' = $myConnection->(Read: 32768)]
[$myConnection->(Close)]
[Output: $Output]
<html><head><title>HTML Document</title></head>>body> ...